package com.wx.chapter16.draw.tankgame2;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/8/14 - 18:50
 */
public class Tank {//坦克类，各种各样的坦克可以继承并重写该类
    private int x;//坦克的横坐标
    private int y;//坦克的纵坐标
    private int direct = 0;//坦克方向 0  上 1  右 2 下 3 左
    private int speed = 7;
    public int getSpeed() {
        return speed;
    }
    public void setSpeed(int speed) {
        this.speed = speed;
    }
    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
    //上右下左移动方法
    public void moveUp() {
        y -= speed;
    }
    public void moveRight() {
        x += speed;
    }
    public void moveDown() {
        y += speed;
    }
    public void moveLeft() {
        x -= speed;
    }
    public int getDirect() {
        return direct;
    }
    public void setDirect(int direct) {
        this.direct = direct;
    }
    public Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }
}
